package TestNet;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Scanner;

public class ServerUDP {
    public static void main (String[] args) throws Exception{
        DatagramSocket socket=new DatagramSocket ();
        Scanner buf = new Scanner (System.in);
        while (true){
            String str=buf.nextLine ();
            DatagramPacket packet=new DatagramPacket
                    (str.getBytes (),0,str.getBytes ().length, InetAddress.getLocalHost (),9000);
            socket.send (packet);
            if (str.equals ("bye")){
                break;
            }
        }
        socket.close ();
    }
}
